Strikeout and other line effects

Requirement

Strikethrough/out, underlining and other line effects.

Solution

Use the ulem package. This package changes text marked to be emphasised by underlining rather than by italicising text. This will affect things like bibliographies, where book titles, for example, that are normally italicised are underlined instead. I find this undesirable, but the author’s thought of that already: it’s possible to switch between default behaviour and non-default behaviour.

In the preamble, tell LaTeX that you want default behaviour as a rule:

usepackage[normalem]{ulem}

If you want a particular portion of the text to behave in the opposite way to the main text, add the following switches around that portion of text:

\ULforem % Switches on underlining and switches off italics for emphasis
\normalem % Switches off underlining and switches on italics for emphasis

Remember to switch the special behaviour off again when you’re finished!

Possible commands are:

\uline{text}
singly underlined text
\uuline{<text>}
doubly underlined text
\uwave{<text>}
wavily underlined text
\sout{<text>}
text with a horizontal line through
\xout{<text>}
text overlaid with forward slashes (no HTML/CSS equivalent)
\dashuline{<text>}
text underlined with dashes
\dotuline{<text>}
text underlined with dots

You can see the ulem package at CTAN.

Example

\documentclass[a4paper,12pt]{article}
\usepackage[normalem]{ulem}% Set the default emphasis style to italics

\begin{document}

\section*{Using \texttt{\char`\\emph}}

This \emph{text} is emphasised with italics (default as set in the preamble).

\ULforem

This \emph{text} is emphasised with an underline (switched using \texttt{\char`\\ULforem}).

\normalem

This \emph{text} is emphasised with italics (switched back to the default using \texttt{\char`\\normalem}).

\section*{Using explicit underlines}

\begin{enumerate}
  \item This \uline{text} is underlined with a single line (\texttt{\char`\\uline}).
  \item This \uuline{text} is underlined with a double line (\texttt{\char`\\uuline}).
  \item This \uwave{text} is underlined with a wavy line (\texttt{\char`\\uwave}).
  \item This \sout{text} is crossed out with a horizontal line (\texttt{\char`\\sout}).
  \item This \xout{text} is obliterated with forward slashes (\texttt{\char`\\xout}).
  \item This \dashuline{text} is underlined with dashed (\texttt{\char`\\dashuline}).
  \item This \dotuline{text} is underlined with dots (\texttt{\char`\\dotuline}).
\end{enumerate}

\end{document}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.